package huoye.shops.huoye.operation.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.codeideology.android.utils.StringUtils;
import com.codeideology.android.widget.ios.dialog.base.BaseDialog;

import huoye.shops.R;
import huoye.shops.base.BaseCustomDialog;


/**
 * Created by uesr on 2018/8/11.
 */

public class OrderDetailsPhomeDialog extends BaseDialog<OrderDetailsPhomeDialog > {


    private Button  btnSendPhone;
    private Context mContext;
    private ImageView ivOut;
    private TextView tvPhone;

    public OrderDetailsPhomeDialog(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public View onCreateView() {
        widthScale(0.75f);
        View inflate = View.inflate(context, R.layout.dialog_order_details_phone, null);
        ivOut = (ImageView) inflate.findViewById(R.id.dialog_order_details_iv_out);
        tvPhone = (TextView) inflate.findViewById(R.id.dialog_order_details_tv_phone);
        btnSendPhone = (Button) inflate.findViewById(R.id.dialog_order_details_btn_send_phone);
        return inflate;
    }

    @Override
    public void setUiBeforShow() {
        ivOut.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });
        btnSendPhone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onSendClick();
                dismiss();
            }
        });
        tvPhone.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onPhoneClick();
                dismiss();
            }
        });
    }

    public void setPhone(String phone){
        tvPhone.setText(phone);
    }

    public void setOnPhoneListener(OnPhoneListener onListener) {
        this.listener = onListener;
    }

    private OnPhoneListener listener;


    public interface OnPhoneListener {
        void onPhoneClick();
        void onSendClick();
    }

}
